package org.example.use;

import com.li.config.RpcServiceConfig;
import com.li.factory.SingletonFactory;
import com.li.provider.ServiceProvider;
import com.li.provider.impl.ZkServiceProviderImpl;
import com.li.registry.ServiceRegistry;
import com.li.registry.zk.ZkServiceRegistryImpl;
import com.li.service.HelloService;
import com.li.service.Impl.HelloServiceImpl;
import com.li.transport.server.RpcServer;
import org.springframework.stereotype.Service;

import java.net.InetSocketAddress;
@Service
public class Server {
    public static void main(String[] args) {
        RpcServer rpcServer = new RpcServer();
        ServiceProvider serviceProvider = SingletonFactory.getInstance(ZkServiceProviderImpl.class);
        HelloService helloService = new HelloServiceImpl();
        RpcServiceConfig rpcServiceConfig = RpcServiceConfig.builder()
                .group("groupLi")
                .version("version2")
                .service(helloService)
                .build();
        serviceProvider.publishService(rpcServiceConfig);

        rpcServer.start();


    }
}
